package pre.service;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import pre.dao.CommDAO;
import pre.vo.commentVO;

@Service("commService")
public class CommService {
	@Resource(name="commDAO")
	CommDAO commDAO;
	
	public ArrayList selectCommList(String num){
		return commDAO.selectAllComm(num);
	}
	public void insertComm(commentVO c){
		commDAO.registerComm(c);
	}
	
	public void updateComm(HashMap<String, String> map){
		commentVO vo = new commentVO();
		vo.setContent(map.get("new_content"));
		vo.setCnum(map.get("cnum"));
		commDAO.updateComm(vo);
	}
	public void deleteComm(String num){
		commDAO.deleteComm(num);
	}
	
	public int getLength(String bnum){
		ArrayList temp = commDAO.selectAllComm(bnum);
		return temp.size();
	}

}
